$INCLUDE: 'C:\FG\FASTGRAF.FI'

      PROGRAM MAIN

      INTEGER*1 KEY, AUX
      INTEGER OLD_MODE
      INTEGER X, Y
      INTEGER FG_GETMAXX, FG_GETMAXY, FG_GETMODE

      CALL FG_INITPM
      OLD_MODE = FG_GETMODE()
      CALL FG_SETMODE(13)
      CALL FG_RESIZE(640,400)

      CALL FG_SETCOLOR(2)
      CALL FG_RECT(0,FG_GETMAXX(),0,FG_GETMAXY())
      CALL FG_SETCOLOR(15)
      CALL FG_BOX(0,FG_GETMAXX(),0,FG_GETMAXY())
      CALL FG_JUSTIFY(0,0)
      CALL FG_MOVE(320,200)
      CALL FG_PRINT('Press arrow keys to pan.',24)

      X = 0
      Y = 0

10    CALL FG_GETKEY(KEY,AUX)
      IF (AUX .EQ. 72 .AND. Y .LT. 200) THEN
         Y = Y + 1
      ELSE IF (AUX .EQ. 75 .AND. X .LT. 320) THEN
         X = X + 1
      ELSE IF (AUX .EQ. 77 .AND. X .GT. 0) THEN
         X = X - 1
      ELSE IF (AUX .EQ. 80 .AND. Y .GT. 0) THEN
         Y = Y - 1
      END IF
      CALL FG_PAN(X,Y)
      IF (KEY .NE. 27) GO TO 10

      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

      STOP ' '
      END
